<admintpl file="header"/>
</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li class="active"><a href="">选项列表</a></li>
        <li class="active"><a href="<?php echo U('vote/addOneOptions', array('vote_id'=>$_GET['id']));?>">添加选手</a></li>
    </ul>

    <form class="js-ajax-form" action="" method="post">
        <table class="table table-hover table-bordered">
            <thead>
            <tr>
            	<th></th>
                <th>名称</th>
                <th>图片</th>
                <th>添加时间</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            <foreach name="list" item="carousel_figure_vo">
                <tr>
                	<td><input name="news_ids[]"  type="checkbox" value="{$carousel_figure_vo.vote_id}"></td>
                    <td>{$carousel_figure_vo.name}</td>
                    <td>{$carousel_figure_vo.cover_image}</td>
                    <td>{$carousel_figure_vo.create_time|date="Y-m-d H:i:s",###}</td>
                    <td>
                        <a id="edit" href="{:U('Vote/editOption', array('option_id'=>$carousel_figure_vo['option_id'], 'vote_id'=>$_GET['id']))}">修改</a>
                        <a id="del" href="javascript:0" onclick="delOption({$carousel_figure_vo['option_id']})">删除</a>
                    </td>
                </tr>
            </foreach>
            </tbody>
        </table>
    </form>
    <div class="pagination">{$page}</div>
</div>
<script src="__PUBLIC__/js/common.js"></script>
<script src="__PUBLIC__/js/layer/layer.js"></script>
<script>
    function delOption(id) {
        if(!id){return false};
        if(!confirm('确定删除此选手吗？')){return false;}

        $.ajax({
            url: "{:U('Vote/delOption')}",
            type: 'POST',
            data: {option_id: id},
            dataType: 'json',
            success: function (res) {
                var res = eval(res);
                if(res.code){
                    window.location.href=window.location;
                    return false;
                }
                alert(res.msg);
            },
            error: function () {
                alert('删除失败，请稍后再试');
            }
        })
    }
</script>
</body>
</html>